IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[cms_sp_EntityMetaFieldLinkAdd]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[cms_sp_EntityMetaFieldLinkAdd]
GO

create procedure [dbo].[cms_sp_EntityMetaFieldLinkAdd]
(
	@Id int = null output,
	@EntityMetaFieldId int,
    @EntityTypeParameter nvarchar(400),
    @DisplayLabel nvarchar(150),
    @IsAllowMultipleValues bit,
    @MetaFieldValues nvarchar(max),
    @IsRequired bit,
    @MetaFieldOrder int,
	@DefaultValue nvarchar(max),
	@EditorName nvarchar(255)
)

as

INSERT INTO [EntityMetaFieldLinks]
           ([EntityMetaFieldId]
           ,[EntityTypeParameter]
           ,[DisplayLabel]
           ,[IsAllowMultipleValues]
           ,[MetaFieldValues]
           ,[IsRequired]
           ,[MetaFieldOrder]
		   ,[DefaultValue]
		   ,[EditorName])
     VALUES
           (@EntityMetaFieldId,
           @EntityTypeParameter,
           @DisplayLabel,
           @IsAllowMultipleValues,
           @MetaFieldValues,
           @IsRequired,
           @MetaFieldOrder,
		   @DefaultValue,
		   @EditorName
           )

set @Id = SCOPE_IDENTITY()
return @Id

GO


